package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.PopulationBean;
import com.sx.zongzhi.bean.PopulationSearchBean;
import com.sx.zongzhi.modle.CollectManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IPopHouseholdView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *获取户籍人员列表
 */
public class PopHouseholdPest {

    private IPopHouseholdView householdView;

    public PopHouseholdPest(IPopHouseholdView householdView) {
        this.householdView=householdView;
    }


    /**
     *
     * @param orgId 网格id
     * @param page 当前页
     * @param rows 当前行
     */
    public void getPopHouseholdList(String orgId, PopulationSearchBean searchBean,int page, int rows){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("searchVo.orgId", orgId);
        if (searchBean!=null){
            map.put("searchVo.name",searchBean.getName());
            map.put("searchVo.idCardNo",searchBean.getIdCardNo());
            map.put("searchVo.currentAddress",searchBean.getCurrentAddress());
            map.put("searchVo.logOut",searchBean.getLogOut());
            map.put("searchVo.isDeath",searchBean.getIsDeath());
            map.put("searchVo.residentStatus",searchBean.getResidentStatus());
            map.put("searchVo.gender",searchBean.getGender());
            map.put("searchVo.nation",searchBean.getNation());
            map.put("searchVo.maritalState",searchBean.getMaritalState());
            map.put("searchVo.politicalBackground",searchBean.getPoliticalBackground());
            map.put("searchVo.schoolStr",searchBean.getSchoolStr());
            map.put("searchVo.birthday",searchBean.getBirthday());
            map.put("searchVo.endBirthday",searchBean.getEndBirthday());
        }
        map.put("page",page);
        map.put("rows", rows);

        new CollectManager().getPopHouseholdList(map, new BaseCallBack<BaseResult<PopulationBean>>() {
            @Override
            public void onSuccess(BaseResult<PopulationBean> response) {
                householdView.getPopHouseholdList(response.getData());
            }
            @Override
            public void onFailures(String message) {
                householdView.showError(message);
            }
        });
    }

}
